#include <iostream>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>

using namespace std;

#define PATH "./fifo"

class Fifo
{
public:
    Fifo(const char* path) :_path(path)
    {
        int n = mkfifo(PATH, 0666);
        if(n == 0)
        {
            cout << "mkfifo sucessful" << endl;
        }
        else 
        {
            cout << "mkfifo error:" << errno << ",errorstring:" << strerror(errno) << endl;
        }
    }
    ~Fifo()
    {
        int n = unlink(_path.c_str());
        if(n == 0)
        {
            cout << "rm sucessful" << endl;
        }
        else
        {
            cout << "rm error:" << errno << ",errorstring:" << strerror(errno) << endl;
        }
    }
private:
    string _path;
};